var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.VisibleNode = undefined;
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;
var _menu = _decorator.menu;
var VisibleNode = function () {
  function _creator() {
    this.name = "";
    this.nd = [];
  }
  __decorate([_property({
    displayName: "控制名称"
  })], _creator.prototype, "name", undefined);
  __decorate([_property({
    type: cc.Node,
    displayName: "控制节点"
  })], _creator.prototype, "nd", undefined);
  return __decorate([_ccclass("VisibleNode")], _creator);
}();
exports.VisibleNode = VisibleNode;
var _def_VisibleController = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.nodes = [];
    t._choiceIndex = 0;
    return t;
  }
  __extends(_creator, e);
  Object.defineProperty(_creator.prototype, "choiceIndex", {
    get: function () {
      return this._choiceIndex;
    },
    set: function () {},
    enumerable: false,
    configurable: true
  });
  _creator.prototype.setSelectedIndex = function (e) {
    if (!(e < 0 || e >= this.nodes.length)) {
      this.selectedIndex = e;
      for (var t = 0; t < this.nodes.length; t++) {
        for (var o = 0; o < this.nodes[t].nd.length; o++) {
          this.nodes[t].nd[o].active = false;
        }
      }
      for (o = 0; o < this.nodes[e].nd.length; o++) {
        this.nodes[e].nd[o].active = true;
      }
    }
  };
  _creator.prototype.setSelectedName = function (e) {
    for (var t = 0; t < this.nodes.length; t++) {
      for (var o = 0; o < this.nodes[t].nd.length; o++) {
        this.nodes[t].nd[o].active = false;
      }
    }
    for (t = 0; t < this.nodes.length; t++) {
      if (this.nodes[t].name == e) {
        this.selectedIndex = t;
        for (o = 0; o < this.nodes[t].nd.length; o++) {
          this.nodes[t].nd[o].active = true;
        }
      }
    }
  };
  _creator.prototype.getSelectedIndex = function () {
    return this.selectedIndex;
  };
  _creator.prototype.getSelectedNodes = function () {
    if (this.selectedIndex) {
      return this.nodes[this.selectedIndex].nd;
    } else {
      return [];
    }
  };
  __decorate([_property({
    type: [VisibleNode],
    displayName: "Controller"
  })], _creator.prototype, "nodes", undefined);
  __decorate([_property({
    type: cc.Integer
  })], _creator.prototype, "_choiceIndex", undefined);
  __decorate([_property({
    type: cc.Integer,
    // tooltip: false
  })], _creator.prototype, "choiceIndex", null);
  return __decorate([_ccclass, _menu("Controller/Visible Controller")], _creator);
}(cc.Component);
exports.default = _def_VisibleController;